#!/bin/sh
#============HEADER==========================================================|
#AUTHOR
# Jefferson Rocha
#
#PROGRAM
# SLACKDESCGEN
#============================================================================|

_USAGE()
{
cat <<EOF
slackdescgen <OPTIONS>

WHAT IS?
slackdescgen is a simple inline TEMPLATE generator for slack-desc.

USAGE:
   -g, --generate
     NAME:        Name of package.
     SMALL DESC:  Small description of your package.  
     HOMEPAGE:    Homepage of your package.

   -h, --help
     Print this manual.

SIMPLE MODE:
   Do not switch the order!!!! <name> <small desc> <homepage>
   slackdescgen --generate slackdescgen 'slackdesckgen simple generate template slack-desc' slackdesc.github.io


Created by Jefferson Rocha BUGS? <lrcjefferson@gmail.com>
EOF

}
_GENERATE()
{
cat > slack-desc <<END
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in.  You must make
# exactly 11 lines for the formatting to be correct.  It's also customary to
# leave one space after the ':'.

        |-----handy-ruler------------------------------------------------------|
$appname: $appname ($short_description)
$appname: 
$appname: 
$appname:  
$appname: 
$appname:  
$appname: 
$appname:  
$appname:
$appname: $homepage
$appname:
END

   echo "Template 'slack-desc' created!"
}

#====MAIN
case $1 in
    -g|-generate)
       shift
       appname="$1"
       shift
       short_description="$1"
       shift
       homepage="$1"
       _GENERATE
    ;;
    -h|--help) _USAGE ;;
    *) _USAGE ;;
esac
